import Cookies from 'js-cookie'
import { isWeixinBrowser,setLocalStorage,setSessionStorage,getLocalStorage, getSessionStorage,removeLocalStorage,removeSessionStorage} from './localStorage'

const key = 'token'

export function getToken() {
  if (isWeixinBrowser()) {
    return localStorage.getItem('token')
  } else {

    return sessionStorage.getItem('token')
  }
}

export function setToken(token) {
  if (isWeixinBrowser()) {

    return localStorage.setItem('token',token)
  } else {
    return sessionStorage.setItem('token',token)
  }
}

export function removeToken() {
  if (isWeixinBrowser()) {

    return localStorage.removeItem('token')
  } else {

    return sessionStorage.removeItem('token')
  }


  // return sessionStorage.removeItem(key)
  // return Cookies.remove(key)
}
export function setLeader(phone){
  if (isWeixinBrowser()) {

    return localStorage.setItem('leader',phone)
  } else {

    return sessionStorage.setItem('leader',phone)
  }
}
export function getLeader(){
  if (isWeixinBrowser()) {

    return localStorage.getItem('leader')
  } else {

    return sessionStorage.getItem('leader')
  }
}

